package servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.ejb.EJB;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.persistence.EntityManager;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
//import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import entity.Item;

import service.ItemService;
import session.Cart;
import session.CartBean;
import util.JpaUtil;

public class Home extends HttpServlet {
	ItemService itemService=new ItemService();
	@EJB Cart cart;
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		
		List<Item> items=cart.getItems();
		request.setAttribute("items", items);
		
		RequestDispatcher dispatcher = request.getRequestDispatcher("Home.jsp");
		if (dispatcher != null) dispatcher.forward(request, response);
		
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
